package nicg.st.util;

import java.util.ArrayList;
import java.util.List;

/**
 * @author GeChen
 * @Description 解析指标体系路径，返回List信息
 * @date 2019/11/3 23:20
 */
public class DecodePath {
	public static List<String> decodePath(String path) {
		List<String> list = new ArrayList<>();
		for (int i = 0; i < path.length(); i++) {
			String temp = "";
			while (path.charAt(i) != '/') {
				temp += path.charAt(i);
				i++;
				if (i == path.length())
					break;
			}
			list.add(temp);
		}
		return list;
	}

	public static int getLevel(String path) {
		List<String> strings = DecodePath.decodePath(path);
		return strings.size();
	}
}